//
// Created by tanghuijuan on 2024/11/6.
//

#ifndef CPP23TEST_STUDENT_H
#define CPP23TEST_STUDENT_H
#include <iostream>
using namespace std;

class Student {
private:
    int sid{};
    string name;
    int *score;
    int coursesCount;
public:
    Student(){
        cout << "Student()" << endl;
    }
    Student(int sid,string name,int num=1) : sid(sid),name(name) {
        score = new int[num];
        coursesCount = num;
        cout << "Student(int,string)" << endl;
    }
    //析构函数
    ~Student(){
        delete score;
        cout << "~Student()" << endl;
    }
    explicit Student(int sid) : sid(sid),name("NULL") {
        cout << "Student(int)" << endl;
    }
    void say() const {
        cout << "I'm a student! My name is " << this->name << ", my id is " << this->sid
        << ", and I have " << coursesCount << " courses. " << endl;
    }
    void setSid(int sid){this->sid = sid;}
    void setName(string name){this->name = name;}
};


#endif //CPP23TEST_STUDENT_H
